SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO

CREATE PROCEDURE [dbo].gspCity_SEARCH
(
@cityId int = null,
@regionId int = null,
@name nvarchar(128) = null,
@isVisible bit = null
)
AS

SELECT
  *
FROM
  [dbo].[City]
WHERE
  (@cityId IS NULL OR [CityId] = @cityId)
AND
  (@regionId IS NULL OR [RegionId] = @regionId)
AND
  (@name IS NULL OR @name = '' OR [Name] LIKE @name + '%')
AND
  (@isVisible IS NULL OR [IsVisible] = @isVisible)


GO
